/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package unc.pds.facets;

import unc.pds.filemodel.AlbumRemote;
import unc.pds.model.Postable;
import unc.pds.model.UserRemote;

/**
 *
 * @author Михаил
 */
public class ShortAlbumsFacet implements Facet {
    public ShortAlbumsFacet(Postable user) {
        this.user = user;
    }
    Postable user;
    public String draw() throws Exception {
        String result = "";
        result += "<h4>Альбомы:</h4>";
        AlbumRemote[] albums = user.getAlbums();
        int count = Math.min(albums.length, 10);
        for (int i = 0; i < count; i++) {
            result += "<p><a href=\"index.jsp?id="+albums[i].getKey()+"\">"+albums[i].getName()+"</a>";
            result += "</p>";
        }
        result += "<p><a href=\"index.jsp?id="+ user.getKey() +"&view=albums\">Больше...</a></p>\n";
        return result;
    }
    public boolean isSide() {
        return true;
    }
}
